<!--
 * @Author: wangming
 * @Date: 2021-12-27 13:44:59
 * @LastEditors: wangming
 * @LastEditTime: 2022-03-31 16:42:53
 * @FilePath: /hanma-application-designer-fed/src/components/HmPermission/HmPermissionLayout.vue
 * @Description: 
-->
<template>
  <component v-if="hasPermission" :is="tag" v-bind="$attrs" v-on="$listeners">
    <slot />
  </component>
</template>

<script>
export default {
  inject: {
    authBypage: {
      default: () => {},
    },
  },
  name: "HmPermissionLayout",
  props: {
    tag: {
      type: String,
      default: "div",
    },
  },
  computed: {
    hasPermission() {
      let authBypage =this.authBypage() || [];
      const id = this.$attrs.id;
      return (
        authBypage.indexOf(id) === -1 || process.env.VUE_APP_USER === "ADMIN"
      );
    },
  },
};
</script>

<style></style>
